#include "GalaxyMap.h"

GalaxyMap::GalaxyMap()
{
	InitializeNodes();
}

GalaxyMap::~GalaxyMap()
{

}

void GalaxyMap::InitializeNodes(void)
{
	for (int i = 0; i < gGridSize; i++)
	{
		for (int j = 0; j < gGridSize; j++)
		{
			Sector* sector = new Sector;
			sector->SetInfo(LRSINFO_UNKNOWN, LRSINFO_UNKNOWN, LRSINFO_UNKNOWN);
			sector->SetCoordinate(i, j);
			mNodeList[i][j] = sector;
		}
	}
}

// set the current object to the given coordinate
void GalaxyMap::SetObject(LRSInformation lrsInfo, Coordinate coord)
{
	((Sector*)mNodeList[coord.x][coord.y])->SetInfo(lrsInfo);
}

void GalaxyMap::SetObject(LRSInformation lrsInfo, int x, int y)
{
	((Sector*)mNodeList[x][y])->SetInfo(lrsInfo);
}

// clears all info
void GalaxyMap::ClearAll(void)
{
	// destroy dynamic memory we generated
	for (int i = 0; i < gGridSize; i++)
	{
		for (int j = 0; j < gGridSize; j++)
		{
			delete mNodeList[i][j];
			mNodeList[i][j] = 0;
		}
	}

	// reinitialize
	InitializeNodes();
}